package com.webdemo01.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBHandler {
	private Connection conn = null;
	DBHandler(){
		try {
		Class.forName("com.mysql.jdbc.Driver");
		String url = "jdbc:mysql://localhost/test_web";
		String username = "dong";
		String passwprd="xiaodong";
			conn = DriverManager.getConnection(url,username,passwprd);
		} catch (SQLException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}
	public Connection getConnection(){
		return conn;
	}
	public static DBHandler newInstance(){
		return new DBHandler();
	}
}
